import QtQuick 2.0
import QtQuick.Window 2.12
import QtQuick.Layouts 1.12
import Qt.labs.qmlmodels 1.0

import iproapps.besttodolist 1.0

Window {
    id :root
    width: 300
    height: 600

    property var model
    property int editIndex


    Rectangle {
        anchors.fill: parent
        color: "lightGrey"

       // ColumnLayout{
           // Loader {
           //     sourceComponent: mainTask
           // }

            ListView{
                Layout.fillHeight: true
                Layout.fillWidth: true

                ListModel {
                    id:modelList
                    ListElement{eleType:"addToMyDay"}
                    ListElement{eleType:"addToMyDay"}
                    ListElement{eleType:"subTask"}
                    ListElement{eleType:"addToMyDay"}
                    ListElement{eleType:"subTask"}
                }
                model:modelList
                delegate: DelegateChooser {
                    role:"eleType"
                    DelegateChoice {
                        roleValue: "subTask"
                        delegate: subTask
                    }
                    DelegateChoice {
                        roleValue: "addToMyDay"
                        delegate: addToMyDay
                    }
                }


            }


        //}
    }
    Component {
        id : mainTask
        Text {
            text: qsTr("text")
        }
    }
    Component {
        id : subTask
        Text {
            text: qsTr("text22")
            height: 16
        }
    }
    Component {
        id :addToMyDay
        Text {
            text: qsTr("text33") +modelList.rowCount()
            height: 16
        }
    }

}
